﻿using System;

namespace SharpTag.ID3
{
    /// <summary>
    /// Concrete implementation of the <see cref="AbstractFrameHeaderFactory"/> class.
    /// </summary>
    public class ID3FrameHeaderFactory : AbstractFrameHeaderFactory
    {
        /// <summary>
        /// Creates a new empty <see cref="IFrameHeader"/> object.
        /// </summary>
        /// <returns>A new empty <see cref="IFrameHeader"/> object.</returns>
        public override IFrameHeader CreateFrameHeader()
        {
            return new ID3V2TagFrameHeader();
        }

        /// <summary>
        /// Creates a new populated <see cref="IFrameHeader"/> object.
        /// </summary>
        /// <param name="frameBytes">Raw frame byte array to be parsed into a new <see cref="IFrameHeader"/> object.</param>
        /// <returns>A new populated <see cref="IFrameHeader"/> object.</returns>
        public override IFrameHeader GetFrameHeader(byte[] frameBytes)
        {
            var headerBytes = new byte[10];
            Array.Copy(frameBytes, 0, headerBytes, 0, 10);

            return new ID3V2TagFrameHeader(headerBytes);
        }
    }
}
